{
  Nassy - anti-spam for IM clients
  Copyright (C) 2008-2009 Denis Shemanayev aka nis
                          mailto: nis@nis.org.ua
                          mailto: Denis.Shemanayev@gmail.com

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License along
  with this program; if not, write to the Free Software Foundation, Inc.,
  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
}
{ $Id: uTrainForm.pas 2 2009-06-07 14:43:34Z Denis.Shemanayev $ }

unit uTrainForm;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TntForms, uMainForm, StdCtrls, Buttons, TntButtons, TntStdCtrls;

type
  TfrmTrain = class(TfrmMain)
    grp1: TTntGroupBox;
    BtnNotSpam: TTntBitBtn;
    BtnSpam: TTntBitBtn;
    MemText: TTntMemo;
    procedure TntFormCreate(Sender: TObject);
    procedure BtnSpamClick(Sender: TObject);
    procedure TntFormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frmTrain: TfrmTrain;

implementation

{$R *.DFM}

uses
  uQipPlugin;

{***********************************************************}
procedure TfrmTrain.TntFormCreate(Sender: TObject);
begin
  frmTrain := Self;
  Plugin.ILButtons.GetBitmap(1, BtnSpam.Glyph);
  Plugin.ILButtons.GetBitmap(0, BtnNotSpam.Glyph);
  MemText.Text := '';
end;

{***********************************************************}
procedure TfrmTrain.BtnSpamClick(Sender: TObject);
begin
  Close;
  Plugin.Classifier.Train(MemText.Text, Boolean((Sender as TComponent).Tag));
end;

{***********************************************************}
procedure TfrmTrain.TntFormClose(Sender: TObject;
  var Action: TCloseAction);
begin
  Action := caFree;
  frmTrain := nil;
end;

end.
